import type { InjectionKey } from "vue";
import type { DragListProps, DragListItemProps } from "../config";

type ScrollEvent = {
		id: string,
		command: "up" | "down" | "stop",
		scrollTop: number
	}

export interface DragListContext {
	props: Required<DragListProps>
	id: string
	length: number
	isMove:boolean
	addField: (field: DragListItemContext) => void
	removeField: (uid: string) => void
	showDragEl: (uid: string, top: number) => void
	handleMove: (y:number) => void
	hiddDragEl: () => void
	pageScroll: (e:ScrollEvent) => void,
	updateChildSort:(uid:string,sort:number) => void,
	updateRowsSort:(sortList:number[]) => void,
}

export interface DragListItemContext {
	props: Required<DragListItemProps>;
	uid: string,
	index: string | number,
	sortNumber:number,
	updateSort:(sort:number) => void
	updateMoveSort:(sort:number) => void
}

export const dragListItemContextKey: InjectionKey<DragListItemContext> = Symbol(
	"EDragListItemContextKey"
);
export const dragListContextKey: InjectionKey<DragListContext> =
	Symbol("EDragListContextKey");
